
package com.idealighter.game.shop.manager;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import com.idealighter.game.backpack.dto.ItemInfo;
import com.idealighter.game.player.manager.PlayerMsgWriter;
import com.idealighter.game.player.struct.Player;
import com.idealighter.game.shop.message.ResBuyItemMsg;

/**
 * 商城消息管理 .
 * 
 * @date 2015年9月2日 下午5:56:31
 *
 */
@Singleton
public class ShopMsgMgr {

  @Inject
  private PlayerMsgWriter msgWriter;

  /**
   * 发送购买物品结果消息 .
   * 
   * @param player 玩家.
   * @param res 0:成功,1:钱不够
   */
  public void sendBuyItemMsg(Player player, int res, int itemId, int itemNum) {
    ResBuyItemMsg msg = new ResBuyItemMsg();
    msg.setRes(res);
    ItemInfo item = new ItemInfo();
    item.setId(itemId);
    item.setNum(itemNum);
    msg.setItem(item);
    msgWriter.writeMsg(player, msg);
  }

}
